Skip to content

Conversation

@C1C0
Copy link
Contributor

@C1C0 C1C0 commented Jan 11, 2026

Edit: Marked as ready for review to hear from @johnnyjoygh what he thinks about this idea. The whole idea is still in just a draft stage.

Motivation

I use memos every day, primarily to write down notes using Zettelkasten method. The idea behind Zettelkasten is, that you write small notes and link them hypertextually together. To maintain clarity in Zettelkasten, it's recommended to maintain Structure notes - e.g. Structure note could be table of contents linking to other memos.

Memos already has the "Link memo" functionality, but in my case, it misses crucial feature, which is position and order of the links within the content. So instead, I currently rather link "basic" memos with "structured" memos manually, as I need to keep links organized in the "structured memo".

image

It would be nice to utilize memo's "Relation" functionality directly from the content, by e.g. linking to other memos, e.g.:

## Random book name

Author: [Random author](memos/author-123) ->this would create reference

Bought in [ABC Book store](https://example.com/buy-random-book) -> this would be just normal link

### Chapter 1 - Is random really random?

#### A sub-category

- [First idea in the book](memos/123) -> this would create reference

Implementation

This is just a prototype to showcase the functionality and potential implementation. In a nutshell, I'm adding goldmark's AST transformer, which runs over the parsed AST and adds AttrMemosRefID attribute to a Link node, in case it includes memos/<id> within the destination.

This is lately gathered in markdown@ExtractAll function and appended to data.MemoRefNames. After that, this Payload content is used in memo_service@CreateMemo function, to automatically generate MemoRelations and append them to relations variable, which is later used for creation of realtions.

Screencast_20260111_144612.webm

Future work and improvements

  • Implementing auto-removal of links, if they are not present in the content
    • Of course, it will require to store in the database, whether the link was created by the "Link memo" action (in that case it should not be removed), or automatically from the content.
  • Extending UPDATE function with this auto-linking functionality
  • Potential of adding "/linkMemo" command, which would automatically open dialog, where user can search for memo to link
  • Visually distinguish "Relation" links in the content from the external links.

Acknowledgements

I'm not experienced in Go. It was learning by doing experience with some amount of help from AI. Initially I wanted to implement this from the frontend only, but that stopped making sense after understanding the overall handling better.

Thank you for the time and dedication you're putting into Memos.

@C1C0 C1C0 marked this pull request as ready for review January 11, 2026 13:49
@C1C0 C1C0 requested a review from johnnyjoygh as a code owner January 11, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant